---
dimensions:
  type:
    primary: conceptual
    detail: architecture
  level: beginner
standard_title: Cheatsheet
language: en
title: Dify Plugin Development Cheatsheet
description: A comprehensive reference guide for Dify plugin development, including
  environment requirements, installation methods, development process, plugin categories
  and types, common code snippets, and solutions to common issues. Suitable for developers
  to quickly consult and reference.
---

### Environment Requirements

-   Python version ≥ 3.12
-   Dify plugin scaffold tool (dify-plugin-daemon)

> Learn more: [Initializing Development Tools](/plugin_dev_en/0221-initialize-development-tools.en)

### Obtaining the Dify Plugin Development Package

[Dify Plugin CLI](https://github.com/langgenius/dify-plugin-daemon/releases)

#### Installation Methods for Different Platforms

**macOS [Brew](https://github.com/langgenius/homebrew-dify) (Global Installation):**

```bash
brew tap langgenius/dify
brew install dify
```

After installation, open a new terminal window and enter the `dify version` command. If it outputs the version information, the installation was successful.

**macOS ARM (M Series Chips):**

```bash
# Download dify-plugin-darwin-arm64
chmod +x dify-plugin-darwin-arm64
./dify-plugin-darwin-arm64 version
```

**macOS Intel:**

```bash
# Download dify-plugin-darwin-amd64
chmod +x dify-plugin-darwin-amd64
./dify-plugin-darwin-amd64 version
```

**Linux:**

```bash
# Download dify-plugin-linux-amd64
chmod +x dify-plugin-linux-amd64
./dify-plugin-linux-amd64 version
```

**Global Installation (Recommended):**

```bash
# Rename and move to system path
# Example (macOS ARM)
mv dify-plugin-darwin-arm64 dify
sudo mv dify /usr/local/bin/
dify version
```

### Running the Development Package

Here we use `dify` as an example. If you are using a local installation method, please replace the command accordingly, for example `./dify-plugin-darwin-arm64 plugin init`.

### Plugin Development Process

#### 1. Create a New Plugin

```bash
./dify plugin init
```

Follow the prompts to complete the basic plugin information configuration

> Learn more: [Dify Plugin Development: Hello World Guide](/plugin_dev_en/0211-getting-started-dify-tool.en)

#### 2. Run in Development Mode

Configure the `.env` file, then run the following command in the plugin directory:

```bash
python -m main
```

> Learn more: [Remote Debugging Plugins](/plugin_dev_en/0411-remote-debug-a-plugin.en)

#### 4. Packaging and Deployment

Package the plugin:

```bash
cd ..
dify plugin package ./yourapp
```

> Learn more: [Publishing Overview](/plugin_dev_en/0321-release-overview.en)

### Plugin Categories

#### Tool Labels

Category `tag` [class ToolLabelEnum(Enum)](https://github.com/langgenius/dify-plugin-sdks/blob/main/python/dify_plugin/entities/tool.py)

```python
class ToolLabelEnum(Enum):
    SEARCH = "search"
    IMAGE = "image"
    VIDEOS = "videos"
    WEATHER = "weather"
    FINANCE = "finance"
    DESIGN = "design"
    TRAVEL = "travel"
    SOCIAL = "social"
    NEWS = "news"
    MEDICAL = "medical"
    PRODUCTIVITY = "productivity"
    EDUCATION = "education"
    BUSINESS = "business"
    ENTERTAINMENT = "entertainment"
    UTILITIES = "utilities"
    OTHER = "other"
```

### Plugin Type Reference

Dify supports the development of various types of plugins:

-   **Tool plugins**: Integrate third-party APIs and services
    > Learn more: [Tool Plugin Development](/plugin_dev_en/0211-getting-started-dify-tool.en)
-   **Model plugins**: Integrate AI models
    > Learn more: [Model Plugin Introduction](/plugin_dev_en/0131-model-plugin-introduction.en), [Quick Integration of a New Model](/plugin_dev_en/0211-getting-started-new-model.en)
-   **Agent Strategy plugins**: Customize Agent thinking and decision-making strategies
    > Learn more: [Agent Strategy Plugins](/plugin_dev_en/9433-agent-strategy-plugin.en)
-   **Extension plugins**: Extend Dify platform functionality, such as Endpoints and WebAPP
    > Learn more: [Extension Plugins](/plugin_dev_en/9231-extension-plugin.en)

{/*
Contributing Section
DO NOT edit this section!
It will be automatically generated by the script.
*/}

<CardGroup cols="2">
    <Card
        title="Edit this page"
        icon="pen-to-square"
        href="https://github.com/alterxyz/dify-docs-plugin-dev/edit/main/plugin_dev_en/0131-cheatsheet.en.mdx"
    >
        Help improve our documentation by contributing directly
    </Card>
    <Card
        title="Report an issue"
        icon="github"
        href="https://github.com/alterxyz/dify-docs-plugin-dev/issues/new?title=Documentation%20Issue%3A%20cheatsheet&body=%23%23%20Issue%20Description%0A%3C%21--%20Please%20briefly%20describe%20the%20issue%20you%20found%20--%3E%0A%0A%23%23%20Page%20Link%0Ahttps%3A%2F%2Fgithub.com%2Falterxyz%2Fdify-docs-plugin-dev%2Fblob%2Fmain%2Fplugin_dev_en%2F0131-cheatsheet.en.mdx%0A%0A%23%23%20Suggested%20Changes%0A%3C%21--%20If%20you%20have%20specific%20suggestions%20for%20changes%2C%20please%20describe%20them%20here%20--%3E%0A%0A%3C%21--%20Thank%20you%20for%20helping%20improve%20our%20documentation%21%20--%3E"
    >
        Found an error or have suggestions? Let us know
    </Card>
</CardGroup>
